<!DOCTYPE html>
<html style="font-size: 14px">
<head>
    {include file="common/meta"}
</head>
<body class="hold-transition sidebar-mini layout-fixed" data-panel-auto-height-mode="height">
<div class="wrapper">
    <!-- 侧边栏 -->
    <aside class="main-sidebar sidebar-dark-teal elevation-4">
        <!-- 左上角标题 -->
        <a href="" class="brand-link">
            <img src="__static__/img/bt.png" class="brand-image img-circle elevation-3" style="opacity: .8">
            <span class="brand-text font-weight-light">{:lang('Backstage panel')}</span>
        </a>

        <div class="sidebar">
            <!-- 菜单搜索 -->
<!--            <div class="form-inline mt-3">-->
<!--                <div class="input-group" data-widget="sidebar-search">-->
<!--                    <input class="form-control form-control-sidebar" type="search" placeholder="{:lang('Search')}" aria-label="Search">-->
<!--                    <div class="input-group-append">-->
<!--                        <button class="btn btn-sidebar">-->
<!--                            <i class="fas fa-search fa-fw"></i>-->
<!--                        </button>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->

            <!-- 菜单栏目 -->
            <nav class="mt-3">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false" id="userMenu">
                </ul>
            </nav>
        </div>
    </aside>

    <!-- 导航栏 -->
    <div class="content-wrapper iframe-mode" data-widget="iframe" data-loading-screen="0">
        <div class="nav navbar navbar-expand navbar-white navbar-light border-bottom p-0 main-header2">
            <!--收缩菜单栏-->
            <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>

            <!--子页管理、标签切换-->
            <a class="nav-link bg-light" href="#" data-widget="iframe-scrollleft"><i class="fas fa-angle-double-left"></i></a>
            <ul class="navbar-nav overflow-hidden" role="tablist">
                <li class="nav-item active default-page" role="presentation">
                    <a class="nav-link active" data-toggle="row" id="tab-index" href="#panel-{:str_replace(['.','/'],'-',url('/index/dashboard'))}" role="tab" aria-controls="panel-{:str_replace(['.','/'],'-',url('/index/dashboard'))}" aria-selected="true">{:lang("Dashboard")}</a>
                </li>
            </ul>
            <a class="nav-link bg-light" href="#" data-widget="iframe-scrollright"><i class="fas fa-angle-double-right"></i></a>

            <!--<a class="nav-link" href="#" data-widget="iframe-fullscreen"><i class="fas fa-expand"></i></a>-->
            <!--垃圾清理、标签关闭-->
            <div class="dropdown">
                <a class="nav-link" data-toggle="dropdown" href="#" id="delop">
                    <i class="far fa-trash-alt"></i>
                </a>
                <div class="dropdown-menu dropdown-menu-right J-clearCache accent-teal" aria-labelledby="delop">
                    <a class="dropdown-item" href="#" data-widget="iframe-close" data-type="all">{:lang('Close all subpages')}</a>
                    <a class="dropdown-item" href="#" data-widget="iframe-close" data-type="all-other">{:lang('Close all other')}</a>
                    {if app('user')->hasSuperAdmin()}
                    <div class="dropdown-divider"></div>
                    <a href="#" data-url="{:url('/index/clearCache',['type'=>'data'])}" class="dropdown-item J_item">{:lang("Clean up all data caches")}</a>
                    <a href="#" data-url="{:url('/index/clearCache',['type'=>'log'])}" class="dropdown-item J_item">{:lang("Clean up all logs")}</a>
                    <a href="#" data-url="{:url('/index/clearCache',['type'=>'temp'])}" class="dropdown-item J_item">{:lang("Clean up all page caches")}</a>
                    {/if}
                </div>
            </div>

            <!--用户登录信息-->
            <div class="dropdown user-image">
                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" title="{$User['nickname']??$User['username']}">
                    <img src="{:empty($User['avatar'])?'__static__/img/user.png':$User['avatar']}" class="img-circle elevation-2">
                </a>
                <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-right border-0">
                    <li class="user-header bg-teal">
                        <img src="{:empty($User['avatar'])?'__static__/img/user.png':$User['avatar']}" class="img-circle elevation-2 text-white">
                        <p>
                            <span>{:lang('Welcome')}, {$User['nickname']??$User['username']}</span>
                            <small>{$User['group_names']}</small>
                            <small>{:lang("Last login")} {$User['lasttime']}</small>
                        </p>
                    </li>
                    <li class="user-footer">
                        <a href="{:url('/index/profile')}" class="btn btn-default  btn-newMenu" data-id="88" data-title="{:lang("Profile")}">{:lang("Profile")}</a>
                        <a href="{:url('/login/logout')}" class="btn btn-default float-right">{:lang("Sign out")}</a>
                    </li>
                </ul>
            </div>

            <!--语言切换-->
            <div class="dropdown">
                <a class="nav-link" data-toggle="dropdown" href="#">
                    <i class="fas fa-language"></i>
                </a>
                <div class="dropdown-menu dropdown-menu-right accent-teal" id="J-lang">
                    {volist name="langs" id="item"}
                    <a href="{:url('/index/index',['lang'=>$key])}" class="dropdown-item {if (app()->lang->getLangSet()==$key)}active{/if}">{$item}</a>
                    {/volist}
                </div>
            </div>

            <a class="nav-link" href="/" target="_blank" title="{:lang("Home page")}"><i class="fas fa-home"></i></a>
<!--            <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">-->
<!--                <i class="fas fa-th-large"></i>-->
<!--            </a>-->
        </div>
        <div class="tab-content">
            <div class="tab-pane default-page fade active show" id="panel-{:str_replace(['.','/'],'-',url('/index/dashboard'))}" role="tabpanel" aria-labelledby="tab-{:str_replace(['.','/'],'-',url('/index/dashboard'))}">
                <iframe src="{:url('/index/dashboard')}"></iframe>
            </div>
            <div class="tab-empty">
                <h2 class="display-4">No tab selected!</h2>
            </div>
            <div class="tab-loading">
                <div>
                    <h3 class="display-4">Tab is loading <i class="fa fa-sync fa-spin"></i></h3>
                </div>
            </div>
        </div>
    </div>

    <!-- 风格控制面板 -->
    <aside class="control-sidebar control-sidebar-dark"></aside>
</div>
<!-- ./wrapper -->

{include file="common/script"}

<script>
    require(['jquery','bootstrap','adminlte','layer'], function ($,undefined,adminlte,undefined) {
        function getMenuList () {  // 获取菜单并显示页面
            Util.ajax({ url:"{:url('/Index/menu')}",async:true },'',function (data) {
                $('#userMenu').html(data);
                // 搜索初始化
                // $('[data-widget="sidebar-search"]').SidebarSearch('init');
            });
        }
        // 缓存清理
        $('.J-clearCache').on('click','.J_item',function (e) {
            Util.ajax({ url:$(this).data('url') },'',function (data,res) {
                Layer.msg(res.msg, {time:1000, icon: 1});
            });
        })

        // 初始化菜单
        getMenuList();
    })
</script>

</body>
</html>